package com.lwq.imserver.controller;

import com.lwq.imserver.model.FriendsApply;
import com.lwq.imserver.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * Description:
 * Author: LiuWenQing
 * Datetime: 2022/2/2 21:46
 */
@RestController
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/user/noReadCount")
    @CrossOrigin("*")
    public Map<String,Object> noReadCount(@RequestParam String userId){
        return userService.noReadCount(userId);
    }

    @PostMapping("user/addFriend")
    @CrossOrigin("*")
    public void addFriend(@RequestBody FriendsApply apply){
        userService.addFriend(apply);
    }

    @PutMapping("/user/apply/confirm/{id}")
    @CrossOrigin("*")
    public void confirmApply(@PathVariable String id){
        userService.confirmApply(id);
    }
}
